package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 巡更分析统计
 *
 * @author ytche
 * @date 2017年8月22日
 *
 */
@Table(name = "tnb_location_analysis_report")
@Entity
@JsonApiResource(type = "personLocationAnalysisReport")
public class PersonLocationAnalysisReport extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Employee employee;
	private List<PersonLocationAnalysis> analysises;
	private Integer serviceNum;
	private Integer exeNum;
	private Integer createTime;
	private Integer generateTime;
	private Integer misMatchNum;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinTable(name = "rel_location_analysis_report", joinColumns = { @JoinColumn(name = "analysis_id") }, inverseJoinColumns = { @JoinColumn(name = "report_id") })
	public List<PersonLocationAnalysis> getAnalysises() {
		return analysises;
	}

	public void setAnalysises(List<PersonLocationAnalysis> analysises) {
		this.analysises = analysises;
	}

	@Column(name = "service_num")
	public Integer getServiceNum() {
		return serviceNum;
	}

	public void setServiceNum(Integer serviceNum) {
		this.serviceNum = serviceNum;
	}

	@Column(name = "exe_num")
	public Integer getExeNum() {
		return exeNum;
	}

	public void setExeNum(Integer exeNum) {
		this.exeNum = exeNum;
	}

	@Column(name = "create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "generate_time")
	public Integer getGenerateTime() {
		return generateTime;
	}

	public void setGenerateTime(Integer generateTime) {
		this.generateTime = generateTime;
	}

	@Column(name = "mis_match_num")
	public Integer getMisMatchNum() {
		return misMatchNum;
	}

	public void setMisMatchNum(Integer misMatchNum) {
		this.misMatchNum = misMatchNum;
	}
}
